<template>
    <div class="app-container">
        <el-dialog :visible="visible" @close="closeOssDialog" title="完工确认">
            <oss v-model="fileList" ossURL="oss/uploadManuscripts" @uploadInfos="receiveFileList" uploadType="text"
                :isShowTip="false" :fileType="[]"></oss>

            <div slot="footer">
                <el-button style="margin-top: 20px;" type="primary" @click="add">提交</el-button>
                <el-button style="margin-top: 20px;" type="primary" @click="closeOssDialog">取消</el-button>
            </div>

        </el-dialog>

    </div>
</template>

<script>
import { uploadTranslateFile } from '@/api/order/orderByEdit';



export default {
    name: "uploadFile",
    components: {
        oss: () => import("@/components/ImageUpload/oss1.vue"),
    },
    data() {
        return {
            fileList: [],
            upload: [],
        }
    },

    props: {
        id: { // 订单id
            type: [String, Number],
            default: 0
        },
        visible: {
            type: Boolean,
            default: false
        }
    },

    methods: {
        add() {
            console.log(this.upload);
            uploadTranslateFile(
                this.id, this.upload, this);
        },

        receiveFileList(fileList) {
            this.upload = fileList.map((item) => {
                return {
                    file: item.url,
                    originName: item.name,
                    size: item.size
                }
            })
        },

        closeOssDialog() {
            this.fileList = [];
            this.upload = [];
            this.$emit("closeOssDialog", false);
        }
    },

}
</script>

<style scoped>
.app-container>>>.el-upload-dragger {
    width: 100%;
    height: 100%;
}
</style>